package serviceset3

import grails.boot.GrailsApp
import grails.boot.config.GrailsAutoConfiguration
import io.micronaut.spring.context.env.MicronautEnvironment
import org.springframework.boot.web.servlet.ServletRegistrationBean
import org.springframework.cloud.client.discovery.EnableDiscoveryClient
import org.springframework.context.annotation.Bean
import org.h2.server.web.WebServlet
import org.springframework.context.annotation.Primary
import org.springframework.core.env.ConfigurableEnvironment

@EnableDiscoveryClient
class Application extends GrailsAutoConfiguration {
    static void main(String[] args) {
        GrailsApp.run(Application, args)
    }

    //embedded h2 console
    @Bean
    ServletRegistrationBean h2servletRegistration(){
        ServletRegistrationBean registrationBean = new ServletRegistrationBean( new WebServlet())
        registrationBean.addUrlMappings("/console/*")
        return registrationBean
    }
}